Log in Register Dashboard Temp Share Shortlinks Frames API

cody - HTMLify profile

cody's Profile Picture

cody

4270 Files

636151 Views

Latest files of /cody/swapnilsparsh/30DaysOfJavaScript/130 - Get Mouse Position

style.css cody/swapnilsparsh/30DaysOfJavaScript/130 - Get Mouse Position/style.css
94 Views
0 Comments
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}

body{
height: 100vh;
index.html cody/swapnilsparsh/30DaysOfJavaScript/130 - Get Mouse Position/index.html
292 Views
0 Comments
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Position of mouse</title>
<link rel="stylesheet" href="./style.css">
Readme cody/swapnilsparsh/30DaysOfJavaScript/130 - Get Mouse Position/Readme
188 Views
0 Comments
Media file
script.js cody/swapnilsparsh/30DaysOfJavaScript/130 - Get Mouse Position/script.js
152 Views
0 Comments
let output = document.getElementById("output");
window.addEventListener("mousemove",(e)=>{
let xPos=e.clientX;
let yPos=e.clientY;
output.innerHTML=`<div><span>X:</span>${xPos}px</div><div><span>Y:</span>${yPos}px</div>`;
})